package com.example.actordemo1.bus;

import akka.actor.AbstractActor;
import akka.actor.ActorRef;
import akka.actor.ActorSystem;
import akka.actor.Props;
import com.example.actordemo1.tools.FutureActor;

public class BusActor extends AbstractActor {
    @Override
    public Receive createReceive() {
        return receiveBuilder().matchAny(o->{
            System.out.println(o);
        }).build();
    }

    public static void main(String[] args) {
        ActorSystem actorSystem = ActorSystem.create("sys");
        ActorRef actorRef = actorSystem.actorOf(Props.create(BusActor.class), "busActor");

//        MyLookupEventBus bus = new MyLookupEventBus();
//        bus.subscribe(actorRef,"add");
//        bus.subscribe(actorRef,"update");
//        bus.subscribe(actorRef,"un");
//
//        bus.publish(new EventVo("add","add"));
//        bus.publish(new EventVo("update","update"));
//
//        bus.unsubscribe(actorRef,"un");
//
//        bus.publish(new EventVo("un","unununu"));

//        actorSystem.eventStream().subscribe()
    }


}
